<HEAD>
  <SCRIPT SRC="../ganja.js"></SCRIPT>
</HEAD>
<BODY><SCRIPT>
// Create the PGA algebra with 3,0,1 signature.
Algebra(3,0,1,()=>{

  // Create a point, using the dual so it is independent of choice of basis.
  var up = (x)=>!(1e0 + x);
  
  // Create the three points of our triangle.
  var p1 = up(.2e1 + .4e3 - .5e2), p2 = up(-1e2 + .2e3), p3 = up(-.5e2+.2e3);
  
  // Create a triangle from the three points.
  var tri = [p1, p2, p3];
  
  // Create a plane through a point.
  var orig = 1e123;
  var p = ()=>((orig|1e2)/orig).Normalized;
  
  // Create a line by joining two points.
  var l1 = up(-.3e1), l2 = up(-.4e1-.5e2),
      Line = ()=>(l1 & l2).Normalized;

  // The orbit of the triangle around the line.
  var Orbit = [];
  for (let i=0; i<32; i++) { 
     let M    = ()=>Math.E**(-i/32*Line); 
     Orbit[i] = ()=>(M * tri * ~M);
  }     

  // Render our graph
  var canvas = this.graph(()=>[
      // points and triangle in green, line in black
        0x00008800, p1, "p1", p2, "p2", p3, "p3",
        0x80008800, tri, 0, "T",
        0x00000000, Line, l1, l2,
      // The orbit, the mirrored line and the mirrored orbit.    
        0xE0008800, ...Orbit, 0, "MT~M",
        0xC0000000, -p*Line*p,
        0xC0000000, -p*tri*p, 0, "-pTp",
        0xC0000088, ...-p*Orbit*p, 0, "-pMT~Mp",
      // The yellow plane.    
        0xC0FFFF00, p, orig, 0, "p",
      ],{gl:true,camera:1+0e1, noZ:true, p:-0.3, h:Math.PI/4});
      
  // Add the graph to the webpage.
  document.body.appendChild(canvas);
})
</SCRIPT></BODY>